feat: implicit user preference learning from conversation log (#54)#64
Merged
Merged
Conversation
Adds a long-term conversation log and a new dream-sequence pass that analyzes accumulated turns for durable preference patterns, saves them as tagged `inferred` memory entries, and clears the log after each pass. - New abstractions: ConversationLogEntry, IConversationLog, ConversationLogOptions - FileConversationLog: JSONL-based store (turns.jsonl), SemaphoreSlim thread safety - FileConversationMemory: fire-and-forget log writes on every AddTurnAsync - DreamService: RunPreferenceInferencePassAsync with sentiment thresholds, built-in pref directive, always-clear log in finally block - DreamOptions: PreferenceInferenceEnabled + PreferenceDirectivePath - AgentMemoryExtensions.WithConversationLog(): explicit opt-in extension - 7 new tests for FileConversationLog (round-trip, clear, concurrent appends) Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
IConversationLog/FileConversationLog) that accumulates all conversation turns as JSONLRunPreferenceInferencePassAsync) that analyzes the log for durable user preference patterns and saves them as taggedinferredmemory entriesWithConversationLog()— existing agents are unaffectedNew files
ConversationLogEntry.cs(SessionId, Role, Content, Timestamp)IConversationLog.csAppendAsync,ReadAllAsync,ClearAsyncConversationLogOptions.csBasePath = "conversation-log"FileConversationLog.csturns.jsonl), thread-safe viaSemaphoreSlimFileConversationLogTests.csModified files
DreamOptions.cs— addedPreferenceInferenceEnabled(defaulttrue) andPreferenceDirectivePath("pref-dream.md")FileConversationMemory.cs— fire-and-forgetsAppendAsyncon everyAddTurnAsyncwhen log is wired inDreamService.cs— preference inference pass with sentiment-based thresholds, built-in directive,finally-guarded log clearAgentMemoryExtensions.cs— addedWithConversationLog()explicit opt-in extensionUsage
Test plan
dotnet build RockBot.slnx— clean build, 0 errorsdotnet test RockBot.slnx— all 539 tests pass, 0 failuresFileConversationLogTestsall pass (round-trip, clear, concurrent appends, missing file)🤖 Generated with Claude Code